/**
 * @version 2007-4-3
 * @author xalinx at gmail dot com
 */
package org.nanhill.wafer.client;

/**
 * Wafer client for manipulate remote cache.
 * 
 * @version 2007-4-3
 * @author xalinx at gmail dot com
 * 
 */
public interface WaferClient {

	/**
	 * @param region
	 * @param key
	 * @param value
	 * @throws RemoteCacheException
	 */
	void put(String region, String key, Object value)
			throws RemoteCacheException;

	/**
	 * @param region
	 * @param key
	 * @param value
	 * @param liveTime
	 * @throws RemoteCacheException
	 */
	void put(String region, String key, Object value, long liveTime)
			throws RemoteCacheException;

	/**
	 * Get item identified by region and key.
	 * 
	 * @param region
	 * @param key
	 * @return
	 * @throws RemoteCacheException
	 */
	Object get(String region, String key) throws RemoteCacheException;

	/**
	 * Get all items of this region.
	 * 
	 * @param region
	 * @return all item array identified by region or empty object array
	 * @throws RemoteCacheException
	 */
	Object[] getAll(String region) throws RemoteCacheException;

	/**
	 * Get part items identified by region and keys.
	 * 
	 * @param region
	 * @param keys
	 * @return part item array identified by region and keys or empty object
	 *         array
	 * @throws RemoteCacheException
	 */
	Object[] getPart(String region, String... keys) throws RemoteCacheException;

	/**
	 * Get items count of this region.
	 * 
	 * @param region
	 * @return
	 * @throws RemoteCacheException
	 */
	long count(String region) throws RemoteCacheException;

	/**
	 * remove item identified by region and key
	 * 
	 * @param region
	 * @param key
	 * @throws RemoteCacheException
	 */
	void remove(String region, String key) throws RemoteCacheException;

	/**
	 * remove part items identified by region and keys
	 * 
	 * @param region
	 * @param keys
	 * @throws RemoteCacheException
	 */
	void removePart(String region, String... keys) throws RemoteCacheException;

	/**
	 * clear all items of this region
	 * 
	 * @param region
	 * @throws RemoteCacheException
	 */
	void clear(String region) throws RemoteCacheException;

}
